package me.sealer.proxy;

import net.sf.cglib.proxy.CallbackFilter;

import java.lang.reflect.Method;

/**
 * @author sealer
 * @date 2016/10/10
 * @email 1178884049@qq.com
 */
public class MyCglibCallbackFilter implements CallbackFilter {
    private static int CREATE = 0;
    private static int DELETE = 1;
    private static int UPDATE = 2;
    private static int QUERY = 3;

    @Override
    public int accept(Method method) {
        String name = method.getName();
        switch (name) {
            case "create":
                return CREATE;
            case "delete":
                return DELETE;
            case "update":
                return UPDATE;
            case "query":
                return QUERY;
        }
        return 0;
    }
}
